package com.fwj.authorization.tenant;

import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * TenantIdContext
 *
 * @author 樊温军
 * @date 2025/3/19 下午12:02
 */
@Component
public class TenantIdContext {
    private static final String KEY_CURRENT_TENANT_ID = "KEY_CURRENT_PROVIDER_ID";
    private static final Map<String, Object> M_CONTEXT = new ConcurrentHashMap<>();

    public static void setCurrentTenantId(String tenantId) {
        M_CONTEXT.put(KEY_CURRENT_TENANT_ID, tenantId);
    }

    public static String getCurrentTenantId() {
        return (String) M_CONTEXT.get(KEY_CURRENT_TENANT_ID);
    }
}

